import 'package:enterprise_v6_app/app/components/custom_app_bar.dart';
import 'package:enterprise_v6_app/app/components/custom_modele/custom_row_title.dart';
import 'package:enterprise_v6_app/app/core/core.dart';
import 'package:enterprise_v6_app/app/core/utils/file_util.dart';
import 'package:enterprise_v6_app/app/data/entities/application/emergency/get_emergency_accident_info_entity.dart';
import 'package:flutter/cupertino.dart';

/// 事故案例详情
class CaseDetail extends StatelessWidget {
  const CaseDetail({super.key});

  @override
  Widget build(BuildContext context) {
    final GetEmergencyAccidentInfoEntity accidentInfo = Get.arguments as GetEmergencyAccidentInfoEntity;
    return Scaffold(
      appBar: CustomAppBar(
        titleText: '详情',
      ),
      body: Column(
        children: [
          Container(
            height: AppDimens.dp12,
            color: AppColors.bg_color_grey,
          ),
          Container(
            height: AppDimens.dp2,
            color: AppColors.blue_button,
          ),
          Container(
            height: AppDimens.dp40,
            width: AppDimens.sw,
            color: const Color(0xFFF4F7FF),
            alignment: Alignment.centerLeft,
            child: Container(margin: EdgeInsets.only(left: AppDimens.dp40), child: Text('事故名称：${accidentInfo.accidentName}', style: AppTextStyles.black_16)),
          ),
          Container(
            padding: EdgeInsets.only(
              left: AppDimens.dp32,
              right: AppDimens.dp20,
              top: AppDimens.dp16,
            ),
            child: Column(
              children: [
                CustomRowTitle(title: '事故类型',content: '${accidentInfo.accidentTypeName}',),
                CustomRowTitle(title: '事故等级',content: '${accidentInfo.accidentLevelName}',),
                CustomRowTitle(title: '发生时间',content: '${accidentInfo.occurrenceTime}',),
                CustomRowTitle(title: '发生地点',content: '${accidentInfo.accidentLocation}',),
                CustomRowTitle(title: '伤亡人数',content: '${accidentInfo.deleted}',),
                CustomRowTitle(title: '事故描述',content: '${accidentInfo.accidentDescription}',),
                CustomRowTitle(title: '事故总结',content: '${accidentInfo.accidentSummary}',),
                CustomRowTitle(title: '相关附件',contentWidget: CupertinoButton(
                  child:  Text('${accidentInfo.accidentFileUrl}'),
                  onPressed: () {
                    FileUtils.openFile(accidentInfo.accidentFileUrl);
                  },
                )),

              ],
            ),
          )
        ],
      ),
    );
  }
}
